using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace FiltronASP.Models.Validators
{
    /// <summary>
    /// Walidator sprawdzajacy czy wprowadzona wartosc zawiera tylko znaki alfanumeryczne razem z polskimi znakami.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
    public class AlpaNumericAttribute : RegularExpressionAttribute
    {
        private const string _pattern = @"^[a-zA-Z\-żźćńółęąśŻŹĆĄŚĘŁÓŃ0-9_\s]+$";
        
        /// <summary>
        /// Konstruktor.
        /// </summary>  
        public AlpaNumericAttribute()
            : base(_pattern)
        {
        }

    }
}
